SOGetNameInfo


C Specification

#include <dolphin/socket.h>
// SOGetNameInfo() flags
#define SO_NI_NOFQDN        0x01
#define SO_NI_NUMERICHOST   0x02
#define SO_NI_NAMEREQD      0x04
#define SO_NI_NUMERICSERV   0x08
#define SO_NI_DGRAM         0x10
#define SO_NI_NUMERICSCOPE  0x20

int SOGetNameInfo( const void* sockAddr,
                   char* node, unsigned nodeLen,
                   char* service, unsigned serviceLen,
                   int flags );

Description

SOGetNameInfo() translates a socket address structure sockAddr to a node name and a service name. SOGetNameInfo() is thread-safe.

Arguments

sockAddr Pointer to a socket address structure to be translated.
node Pointer to a buffer to receive the node name or NULL.
nodeLen Size of node buffer.
service Pointer to a buffer to receive the service name or NULL.
serviceLen Size of service buffer.
flags Zero or the bitwise OR of the following values:
 
SO_NI_NOFQDN        Get only the node name portion of the fully qualified domain name (FQDN).
SO_NI_NUMERICHOST   Get the numeric form string of the address contained in the socket address structure in node.
SO_NI_NAMEREQD      Get an error if the host name cannot be located.
SO_NI_NUMERICSERV   Get the numeric form string of service (port number) in service.
SO_NI_DGRAM         Locate a datagram service (SO_SOCK_DGRAM). The default is a stream service (SO_SOCK_STREAM).

Return Values

zero Succeeded.
SO_EAI_AGAIN Name could not be resolved. Future attempt may succeed.
SO_EAI_BADFLAGS Specified flags is invalid.
SO_EAI_FAIL A non-recoverable error occurred.
SO_EAI_FAMILY Unknown address family.
SO_EAI_NONAME Name could not be resolved.
SO_EAI_SYSTEM A system error occurred.
SO_EAI_OVERFLOW Buffer overflow. node or service buffer is too small.

See Also

SOGetHostByAddr()